import java.io.FileInputStream;
import java.io.IOException;

import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

import sun.audio.AudioData;
import sun.audio.AudioPlayer;
import sun.audio.AudioStream;
import sun.audio.ContinuousAudioDataStream;
import view.MainWindow;

/**
 * Executes the Game. <code>.....<br>
 * ..-...<br>
 * .sdfwsd</code>
 * 
 * @author Richard
 * 
 */
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		try {
			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (InstantiationException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (UnsupportedLookAndFeelException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		MainWindow window = new MainWindow();
		window.setVisible(true);

		AudioStream backgroundMusic;
		AudioData musicData;
		AudioPlayer musicPlayer = AudioPlayer.player;
		ContinuousAudioDataStream loop = null;
		try {
			backgroundMusic = new AudioStream(new FileInputStream(
					"resources/background.wav"));
			musicData = backgroundMusic.getData();
			loop = new ContinuousAudioDataStream(musicData);
			musicPlayer.start(loop);
		} catch (IOException error) {
			error.printStackTrace();
		}

	}

}
